<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>用户页面</title>
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <link rel="stylesheet" href="js/plugins/dialog2/dialog.css">
    <link rel="stylesheet" href="/js/bootstrap/css/bootstrap.min.css">
    <script src="/js/jquery/jquery.min.js"></script>
    <script src="/js/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="/css/font/css/font-awesome.min.css">
    <link rel="stylesheet" href="/css/reset.css">
    <script src="js/plugins/dialog2/dialog.min.js"></script>
    <link rel="stylesheet" href="/css/register.css">
    <script src="js/plugins/jquery-form/jquery.form.js"></script>
    <script src="js/plugins/jquery-validation/jquery.validate.min.js"></script>
    <script>
        $(function () {
            $("#registerForm").validate({
                rules: {
                    email: {
                        required: true,
                        email: true,
                    }
                },
                messages: {
                    email: {
                        required: "必须填写邮箱",
                        email: "请输入邮箱格式",
                    }
                },
                submitHandler: function (form) {
                    $(form).ajaxSubmit(function (data) {
                        if (data.success) {
                            $(document).dialog({
                                type: 'confirm',
                                style: 'IOS',
                                titleShow: false,
                                content: '验证码已发送',
                                buttons: [
                                    {
                                        name: '请登录邮箱获取',
                                        callback: function () {

                                            window.parent.location.href = "/reset.html"
                                        }
                                    }
                                ]
                            });


                        } else {
                            $(document).dialog({
                                autoClose: 2500,
                                content: data.msg,
                            });
                        }
                    })
                }

            })

        })
    </script>
    <script src="js/plugins/jquery-validation/messages/messages_cn.js"></script>
</head>
<body>

<div class="container">
    <h5>重置密码</h5>
    <div class="card card-container ">
        <i id="profile-img" class="fa fa-user-plus fa-5x profile-img" aria-hidden="true"></i>
        <form class="form-signin" id="registerForm" method="post" action="/sessions/email">
            <input name="email" class="form-control badge-pill" placeholder="邮箱">
            <button class="btn btn-lg badge-pill" type="submit">确定</button>
        </form>
    </div>
</div>

</body>
</html>
